﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pipes
{
  public static class Extension
  {
    public static S Pipe<T, S>(this IEnumerable<T> input, S output) where S : IPipeInput<T>
    {
      output.Initialize(input);
      return output;
    }
    public static string NullToString(this object obj)
    {
      if (obj == null)
      {
        return null;
      }
      else
      {
        return obj.ToString();
      }
    }

    public static bool IsEqual(object x, object y)
    {
      if (x == null && y == null)
      {
        return true;
      }
      else if (x == null || y == null)
      {
        return false;
      }
      else
      {
        return x.Equals(y);
      }
    }
  }
}
